home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / Mark Pilgrim / MSG Demo 1.4 / source / Shell ƒ / graphics.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-10-30  |  4.2 KB  |  105 lines  |  [TEXT/KAHL]

  1. /**********************************************************************\
  2.  
  3. File:        graphics.h
  4.  
  5. Purpose:    This is the header file for graphics.c
  6.  
  7. This program is free software; you can redistribute it and/or modify
  8. it under the terms of the GNU General Public License as published by
  9. the Free Software Foundation; either version 2 of the License, or
  10. (at your option) any later version.
  11.  
  12. This program is distributed in the hope that it will be useful,
  13. but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15. GNU General Public License for more details.
  16.  
  17. You should have received a copy of the GNU General Public License
  18. along with this program in a file named "GNU General Public License".
  19. If not, write to the Free Software Foundation, 675 Mass Ave,
  20. Cambridge, MA 02139, USA.
  21.  
  22. \**********************************************************************/
  23.  
  24. #include "QDOffscreen.h"
  25.  
  26. typedef struct
  27. {
  28.     int                    windowIndex;            /* index of window in program's window list */
  29.     int                    windowWidth;            /* width of window content, in pixels */
  30.     int                    windowHeight;            /* height of window content, in pixels */
  31.     int                    windowType;                /* type of window (see IM Essentials, 4-80) */
  32.     Boolean                hasCloseBox;            /* window has a close box */
  33.     Boolean                offscreenNeedsUpdate;    /* TRUE if offscreen bitmap needs redrawing */
  34.     Point                initialTopLeft;            /* initial window bounds when opened */
  35.     Rect                windowBounds;            /* on screen rectangle of window content */
  36.     Str31                windowTitle;            /* pascal string, title of window */
  37. } WindowDataRec, *WindowDataPtr, **WindowDataHandle;
  38.  
  39. typedef int (*dispatchProcPtr)(WindowDataHandle theData, int theMessage, unsigned long misc);
  40.  
  41. typedef struct                                    /* exactly the same as WindowDataRec */
  42. {                                                /* + dispatchProc at end */
  43.     int                    windowIndex;
  44.     int                    windowWidth;
  45.     int                    windowHeight;
  46.     int                    windowType;
  47.     Boolean                hasCloseBox;
  48.     Boolean                offscreenNeedsUpdate;
  49.     Point                initialTopLeft;
  50.     Rect                windowBounds;
  51.     Str31                windowTitle;
  52.     dispatchProcPtr        dispatchProc;            /* called with message of windowish event */
  53. } ExtendedWindowDataRec, *ExtendedWindowDataPtr, **ExtendedWindowDataHandle;
  54.  
  55. enum                    /* messages passed to window's dispatch procedure */
  56. {
  57.     kNull=0,            /* on null event when window is active, frgrnd/bkgrnd */
  58.     kStartup,            /* on program startup */
  59.     kShutdown,            /* on program shutdown */
  60.     kInitialize,        /* just before window is created & shown */
  61.     kOpen,                /* just after window is created & shown */
  62.     kUpdate,            /* during window update -- draw contents to current grafport */
  63.     kClose,                /* just before window is closed -- this can cancel close */
  64.     kDispose,            /* just after window is closed/disposed */
  65.     kActivate,            /* on window activate event */
  66.     kDeactivate,        /* on window deactivate event */
  67.     kSuspend,            /* on program suspension (switched into background) */
  68.     kResume,            /* on program resuming (switching into foreground) */
  69.     kKeydown,            /* on keydown event when window is active & in foreground */
  70.     kMousedown            /* on mousedown event in window content when active & in frgrnd */
  71. };
  72.  
  73. enum                    /* return codes from window dispatch procedure */
  74. {
  75.     kSuccess=0,            /* message handled, no further processing please */
  76.     kFailure,            /* message not handled, use default action if any */
  77.     kCancel                /* message refused, cancel action (only good with kClose) */
  78. };
  79.  
  80. /***************************************************************************************/
  81.  
  82. enum                    /* window indices in gTheWindow[] and gTheWindowData[] lists */
  83. {
  84.     kAbout=0,            /* about box */
  85.     kAboutMSG,            /* "About MSG" splash screen */
  86.     kHelp,                /* help window */
  87.     kMainWindow            /* main graphics window */
  88. };
  89.  
  90. #define        NUM_WINDOWS                4        /* total number of windows (see above enum) */
  91.  
  92. extern    WindowPtr        gTheWindow[NUM_WINDOWS];
  93. extern    ExtendedWindowDataHandle
  94.                         gTheWindowData[NUM_WINDOWS];
  95.  
  96. Boolean InitTheGraphics(void);
  97. void ShutDownTheGraphics(void);
  98. void OpenTheWindow(int index);
  99. void GetMainScreenBounds(void);
  100. int GetWindowDepth(ExtendedWindowDataHandle theData);
  101. void UpdateTheWindow(ExtendedWindowDataHandle theData);
  102. Boolean CloseTheWindow(ExtendedWindowDataHandle theData);
  103. void DrawThePicture(PicHandle *thePict, int whichPict, int x, int y);
  104. Boolean ReleaseThePict(PicHandle thePict);
  105.